package com.example.demo.async;

import com.example.demo.entity.UserInfo;
import com.example.demo.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 异步任务服务接口实现
 * @author LF
 * @date 2021/4/19 - 16:49
 */
@Service
@Slf4j
public class AsyncServiceImpl implements AsyncService {

    @Autowired
    UserInfoService userInfoService;

    @Override
    public void testAsync(){
        List<UserInfo> list = userInfoService.list();
        list.forEach(System.out::println);
        log.info("currentThreadName01=========="+Thread.currentThread().getName());
    }
    @Override
    public void testOne(){
        List<UserInfo> list = userInfoService.list();
        list.forEach(System.out::println);
        log.info("currentThreadName01=========="+Thread.currentThread().getName());
    }
}
